import request from "../utils/request";


export function examinationList(bean, currentPage, pageSize) {
    return request({
        url: "examination/examinations",
        method: 'get',
        params: {
            ...bean,
            currentPage,
            pageSize
        }
    })
}


export function addExamination(bean) {
    return request({
        url: "examination/add",
        method: 'post',
        data: {
            ...bean,
        }
    })
}

export function deleteExamination(id) {
    return request({
        url: "examination/delete",
        method: 'post',
        data: {
            id
        }
    })
}

export function deleteExaminationByIds(ids) {
    return request({
        url: "examination/deletes",
        method: 'post',
        data: {
            ids
        }
    })
}

export function updateExamination(bean) {
    return request({
        url: "examination/update",
        method: 'post',
        data: {
            ...bean
        }
    })
}

export function getExaminationById(id) {
    return request({
        url: "examination/get/" + id,
        method: 'get',
    })
}

export function exportExamination(ids) {
    return request({
        url: "examination/export",
        method: 'post',
        responseType: "blob",
        data: {
            ids
        }
    })
}

export function randomQuestions(bean) {
    return request({
        url: "examination/randomQuestions",
        method: 'post',
        data: {
            ...bean
        }
    })
}

export function testPage(id) {
    return request({
        url: "examination/testPage",
        method: 'get',
        params: {
            examId: id
        }
    })
}

export function examInfo(bean, currentPage, pageSize) {
    return request({
        url: "examination/examInfo",
        method: 'get',
        params: {
            ...bean,
            currentPage,
            pageSize
        }
    })
}


export function examRegistration(bean) {
    return request({
        url: "examination/examRegistration",
        method: 'post',
        data: {
            ...bean,
        }
    })
}


export function myExam(currentPage, pageSize) {
    return request({
        url: "examination/myExam",
        method: 'get',
        params: {
            currentPage, pageSize
        }
    })
}


export function querySelfExamRegistration(examId) {
    return request({
        url: "examination/querySelfExamRegistration",
        method: 'get',
        params: {
            examId
        }
    })
}


export function answerSheetTestPaper(examId) {
    return request({
        url: "examination/answerSheetTestPaper",
        method: 'get',
        params: {
            examId
        }
    })
}


export function submitAnswerSheet(examId, answerSheet) {
    console.log(answerSheet)
    return request({
        url: "examination/submitAnswerSheet",
        headers: {
            "Content-Type": "application/json"
        },
        method: 'post',
        params: {
            examId
        },
        data: answerSheet
    })
}


export function getOnlineExameeInfo(examId) {
    return request({
        url: "examination/getOnlineExameeInfo",
        method: 'get',
        params: {
            examId
        }
    })
}

//考试心跳
export function exameeOnliner(bean) {
    return request({
        url: "examination/exameeOnliner",
        method: 'post',
        data: bean
    })
}

//接收考试心跳
export function getOnlineExameeHeat(examId) {
    return request({
        url: "examination/getOnlineExameeHeat",
        method: 'get',
        params: {
            examId
        }
    })
}

//开放考试成绩查询
export function announceResults(examId) {
    return request({
        url: "examination/announceResults",
        method: 'post',
        data: {
            examId
        }
    })
}

//成绩查询
export function selfScoreQuery(examId) {
    return request({
        url: "examination/selfScoreQuery",
        method: 'get',
        params: {
            examId
        }
    })
}

//成绩查询
export function selfTestPaperQuery(examId) {
    return request({
        url: "examination/selfTestPaperQuery",
        method: 'get',
        params: {
            examId
        }
    })
}
